package com.haredot.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.haredot.validation.Update;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * 
 * @TableName tb_resource_type
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName(value ="tb_resource_type")
public class ResourceType implements Serializable {

    @Serial
    private static final long serialVersionUID = 3153156747371972293L;
    /**
     * 
     */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "ID不允许为空", groups = Update.class)
    private Long id;

    /**
     * 分类名称
     */
    @TableField("name")
    @NotEmpty(message = "资源类型名不允许为空")
    private String name;

    /**
     * 上级分类ID
     */
    @TableField("pid")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long pid;

    /**
     * 录入时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * 是否生效
     */
    private Boolean state;

    /**
     * 删除标识
     */
    private Boolean del;

}